#include "NetWorkProDefine.h"

#include <stdio.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>


int main()
{
    int listenfd,connfd, udpfd, nready, maxfdpl;
    char mesg[MAXLEN];
    pid_t childpid;
    fd_set rset;
    ssize_t len;
    const int on = 1;
    struct sockaddr_in cliaddr, servaddr;

    void sig_child(int);

    listenfd = socket(AF_INET, SOCK_STREAM, 0);

    bzero(&servaddr, sizeof(servaddr));
    servaddr.sin_family = AF_INET;
    servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
    servaddr.sin_port = htons(SERV_PORT);

    setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
    bind(listenfd, (SA*) &servaddr, sizeof(servaddr));
    listen(listenfd, LISTENENQ);
}